package com.itheima.homework15;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.Scanner;

public class Test06 {
    public static void main(String[] args) throws Exception {
        Socket socket=new Socket("127.0.1.0",10083);
        Scanner sc=new Scanner(System.in);
        //读本地
       // BufferedInputStream bis=new BufferedInputStream(new FileInputStream());
        //网络中输出
        BufferedOutputStream bos=new BufferedOutputStream(socket.getOutputStream());
        //读服务器返回的信息
        BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
           String str=sc.nextLine();
            bos.write(str.getBytes(),0,str.getBytes().length);


            socket.shutdownOutput();//告知服务器数据写完了，给出一个结束标记

        String s = br.readLine();
        System.out.println("服务器返回："+s);
       // bis.close();
        socket.close();
    }
}
